package com.zxx.pattern.observerPattern.observer_Z;

import java.util.Observable;

/**
 * 倒计时 被观察者
 * @author zxx on 2021/3/9
 */
public class WatchedCounter extends Observable {

    public void countdown(int number){
        for (; number >= 0; --number) {
            //设置改变变量
            setChanged();

            //通知所有观察者，将number传递过去
            notifyObservers(number);
        }
    }

}
